{extend name="base" /}
{block name="title"}
管理后台
{/block}
{block name="main"}

      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">表格</strong> / <small>Table</small></div>
      </div>

      <hr>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
<!--              <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 保存</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-archive"></span> 审核</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-trash-o"></span> 删除</button>-->
            </div>
          </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
          <div class="am-form-group">
              会员名称:{$user.username}
<!--            <select data-am-selected="{btnSize: 'sm'}">
               
            </select>
              <button class="am-btn am-btn-default" type="button">确认</button>-->
          </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
          <div class="am-input-group am-input-group-sm">
              <input type="text" class="am-form-field" style="opacity: 0;">
          <span class="am-input-group-btn">
              <button class="am-btn am-btn-default" type="button" onclick="window.location.reload();">刷新</button>
          </span>
          </div>
        </div>
      </div>

      <div class="am-g">
        <div class="am-u-sm-12">
          <form class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main">
              <thead>
              <tr>
                <th class="table-check"><input type="checkbox" /></th><th class="table-id">ID</th><th class="table-title">题目内容（部分）</th><th class="table-type">正确答案</th><th class="table-author am-hide-sm-only">学生答案</th><th class="table-date am-hide-sm-only">答题时间</th><th class="table-set">操作</th>
              </tr>
              </thead>
              <tbody>
              {foreach name="data.list.data" item="vo"}
              
              <tr>
                <td><input type="checkbox" value="{$vo.id}" /></td>
                <td>
                {$vo.id}
                </td>
                <td><?php
                $obj=new service\services\QuestionService();
                $Question=$obj->getQuestionById($vo['question_id']);
                if(isset($Question['content'])){
                    echo strip_tags(htmlspecialchars_decode($Question['content']));
                }
                ?></td>
                <td>
                <?php
                $right_answer=json_decode($vo['right_answer'], true);
                if(is_array($right_answer)){
                    foreach($right_answer as $kk=>$vv){
                        if(is_array($vv)){
                            echo $vv[0].' ';
                        }else{
                            echo $vv.' ';
                        }
                    }
                }else{
                    echo str_replace('"', "", $vo['right_answer']);
                }
                ?>
                </td>
                <td><?php echo str_replace('"','',str_replace('###', ' ', $vo['user_answer'])); ?> <?php if($vo['user_answer']==false)echo "你没有作答";  ?></td>
                <td>{$vo.etime|date="Y-m-d H:i:s",###}</td>
                <td>
                    <a href="{url link='errQuestionxx'  vars='id=$vo[id]' suffix='true' domain='true'}" class="alert_href">详情</a>
                </td>
              </tr>
              {/foreach}
              </tbody>
            </table>
            <div class="am-cf">
              共  {$data.list.total}条记录
              <div class="am-fr">
                {$data.page}
              </div>
            </div>
            <hr />
            <p>注：.....</p>
          </form>
        </div>

      </div>

<script src="/static/js/jquery-1.11.3.js"></script>
<script src="/static/layer/layer.js"></script>
<script>
$(".alert_href").click(function(e){
    var href=this.href;
    layer.open({
        type: 2,
        title: false,
        closeBtn: 0, //不显示关闭按钮
        shade: [0],
        area: ['70%', '70%'],
        offset: 'rb', //右下角弹出
        time: 100, //2秒后自动关闭
        anim: 2,
        content: [href, 'no'], //iframe的url，no代表不显示滚动条
        end: function(){ //此处用于演示
          layer.open({
            type: 2,
            title: '错题详情',
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['70%', '70%'],
            content: href
          });
        }
      });
    return false;
});
</script>
{/block}
